/*
 * AESEncrypter.h
 *
 *  Created on: Mar 22, 2010
 *      Author: Lukasz Spintzyk
 */

#ifndef AESENCRYPTER_H_
#define AESENCRYPTER_H_

#include "ph.h"
#include <openssl/aes.h>
#include "BigInteger.h"

/**
 * Encrypter interface. Uses CTR -mode of block cipher.
 */
class AESEncrypter
{
public:
	AESEncrypter(BigInteger& init_vector, byte* key);
	virtual ~AESEncrypter();

	virtual void* encrypt(const void* inbuffer, uint32_t size, uint32_t nr) = 0;
	virtual void* decrypt(const void* buffer, uint32_t size, uint32_t nr) = 0;

	AES_KEY getKey() const;
public:
	const static uint32_t s_keySize;
	const static uint32_t s_expandedKeySize;
	const static uint32_t s_roundNum;
	const static uint32_t s_blockSize;

protected:
	AESEncrypter ();
	AES_KEY d_key;
	BigInteger iv;
};



#endif /* ENCRYPTER_H_ */
